<template>
  <div>
    <h1>我是day05组件</h1>
    <button @click="btn()">提供全局事件</button>
  </div>
</template>

<script>
import pubsub from "pubsub-js"
export default {
    name:"MyDay05",
    data() {
        return {
            userName:"王谦",
        }
    },
    methods:{
        btn(){
            // this.$bus用于兄弟通信，隔代通信
            this.$bus.$emit("wq",this.userName)
            this.$bus.age = 18;
            // 消息发布，用于兄弟通信，隔代通信
            pubsub.publish("demo",this.userName)
        },
    },
}
</script>

<style>

</style>